package com.genius.smsdao.teachermanage.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.genius.smsbase.Domain.BaseEntity;

import javax.persistence.*;
import java.util.List;


/**
 * @Entity:Department 部门实体类
 * 对应数据库表名：department
 * @author：   yuanquan
 */
@Entity
@Table(name = "department")
public class Department extends BaseEntity<Long> {

    @Column
    private String name;

    //部门到教师一对多关系
    @JsonIgnoreProperties(value = "department",allowSetters = true)
    @OneToMany(mappedBy = "department",cascade = {CascadeType.REMOVE,CascadeType.REFRESH},fetch = FetchType.EAGER)
    private List<Teacher> teacherList;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Teacher> getTeacherList() {
        return teacherList;
    }

    public void setTeacherList(List<Teacher> teacherList) {
        this.teacherList = teacherList;
    }

    @Override
    public String toString() {
        return "Department{" +
                "name='" + name + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", id=" + id +
                '}';
    }
}
